<?php

namespace backend\modules\wechat\controllers;

use backend\controllers\DashboardController;
use Yii;

class UserController extends DashboardController
{
    public $layout = "@backend/views/layouts/wechat";
    /**
     * Renders the index view for the module
     * @return string
     */
    public function actionIndex()
    {

        $wechatUser = Yii::$app->wechat(1)->user->list();

        $userInfo = array();
        if ($wechatUser['data']['openid']){
            $userInfo = Yii::$app->wechat(1)->user->select($wechatUser['data']['openid']);
        }

        $users = $userInfo['user_info_list'];

        return $this->render('index',compact('users'));
    }
}
